load

abstract suspend fun load(scene: String, overrideEditorConfig: Boolean = false, waitForResources: Boolean = false, onProgress: (Int) -> Unit? = null): DesignBlock

Load the contents of a scene file.

Return

the handle to the loaded scene.

Parameters

scene

The scene file contents, a base64 string.

overrideEditorConfig

Whether to override editor configuration with settings and data from the scene file. Defaults to false.

waitForResources

Whether to wait for all resources to finish loading before returning. Defaults to false.

onProgress

Optional. Receives the percentage of an archive that the engine has read, as described for the load function that takes a Uri. Scene file contents give no call.


abstract suspend fun load(sceneUri: Uri, overrideEditorConfig: Boolean = false, waitForResources: Boolean = false, onProgress: (Int) -> Unit? = null): DesignBlock

Load a scene from the resource of a scene or archive file. The file will be fetched asynchronously by the engine and loaded as an archive or as a scene file depending on its content. This loads .imgly files as well as the legacy .scene and .zip formats.

Cancelling the coroutine stops the download, and the current scene stays.

Return

the handle to the loaded scene.

Parameters

sceneUri

the resource to load: a scene file or an archive.

overrideEditorConfig

Whether to override editor configuration with settings and data from the scene file. Defaults to false.

waitForResources

Whether to wait for all resources to finish loading before returning. Defaults to false.

onProgress

Optional. Receives the percentage of the archive that the engine has read, from 0 to 100, once for each whole percent. It is called only with the setting features/fileSystemUsageEnabled on, which is off by default. An archive that the engine streams reports each percent. An archive that is already in memory reports only 100, and a scene file gives no call. The call with 100 can come after this function returns. The engine reports 100 before it parses the scene, so the load can still fail after that call. All calls run on the engine thread.